﻿<Window x:Class="BigWoo.Apps.CertToolGui.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:proj="clr-namespace:BigWoo.Apps.CertToolGui"
        Title="Certificate Browser" 
        Height="600" 
        Width="800">
    
    <Window.CommandBindings>
        <CommandBinding Command="proj:AllCommands.AltCCommand" Executed="AltC_CommandBinding_Executed" />
        <CommandBinding Command="proj:AllCommands.AltSCommand" Executed="AltS_CommandBinding_Executed" />
    </Window.CommandBindings>
    
    <DockPanel>
       
        <Grid 
            DockPanel.Dock="Top"
            >
            <Grid.RowDefinitions>
                <RowDefinition MaxHeight="230"/>
                <RowDefinition MaxHeight="30"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>

            <StackPanel
                Grid.Row="0"
                Grid.Column="0"
                Orientation="Vertical"
                Margin="5,5,5,5"
                >
                <Label Content="Store Type:" />
                <CheckBox Content="AddressBook" Margin="5,2,2,2" IsChecked="{Binding AddressBookType}"/>
                <CheckBox Content="AuthRoot" Margin="5,2,2,2" IsChecked="{Binding AuthRootType}"/>
                <CheckBox Content="CertificateAuthority" Margin="5,2,2,2" IsChecked="{Binding CertificateAuthorityType}"/>
                <CheckBox Content="Disallowed" Margin="5,2,2,2" IsChecked="{Binding DisallowedType}"/>
                <CheckBox Content="My" Margin="5,2,2,2" IsChecked="{Binding MyStoreType}"/>
                <CheckBox Content="Root" Margin="5,2,2,2" IsChecked="{Binding RootType}"/>
                <CheckBox Content="TrustedPeople" Margin="5,2,2,2" IsChecked="{Binding TrustedPeopleType}"/>
                <CheckBox Content="TrustedPublisher" Margin="5,2,2,2" IsChecked="{Binding TrustedPublisherType}"/>
            </StackPanel>
            
            <StackPanel
                Grid.Row="0"
                Grid.Column="1"
                Orientation="Vertical"
                Margin="5,5,5,0"
                >
                <Label Content="Store Location:" />
                <CheckBox Content="CurrentUser" Margin="5,5,5,5" IsChecked="{Binding CurrentUserLocation}"/>
                <CheckBox Content="LocalMachine" Margin="5,5,5,5" IsChecked="{Binding LocalMachineLocation}"/>
                <Button
                    Content="Search"
                    MaxHeight="25"
                    Margin="5,50,5,0"
                    Command="proj:AllCommands.AltSCommand"
                    />
            </StackPanel>

            <Label 
                Margin="5,0,1,0"
                MinHeight="25"
                MaxHeight="25"
                Content="Results:" 
                Grid.Column="0"
                Grid.Row="1" 
                VerticalContentAlignment="Bottom"
                />
        </Grid>
                    
        <DataGrid 
            x:Name="resultsGrid" 
            AutoGenerateColumns="False"
            ItemsSource="{Binding }"
            Margin="5,0,5,5"
            >
            <DataGrid.Columns>
                <DataGridTextColumn Header="Store" MinWidth="15" Binding="{Binding Path=StoreName}" />
                <DataGridTextColumn Header="Location" MinWidth="15" Binding="{Binding Path=StoreLocation}" />
                <DataGridTextColumn Header="Name"  Binding="{Binding Path=CertName}"/>
                <DataGridTextColumn Header="Subject"  Binding="{Binding Path=Subject}"/>
                <DataGridTextColumn Header="Serial #"  Binding="{Binding Path=SerialNo}"/>
                <DataGridTextColumn Header="Thumbprint" MinWidth="200" Width="*"  Binding="{Binding Path=ThumbPrint}"/>
            </DataGrid.Columns>           
            <DataGrid.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="Copy to Clipboard" Command="proj:AllCommands.AltCCommand" />
                </ContextMenu>
            </DataGrid.ContextMenu>
        </DataGrid>
    </DockPanel>
</Window>
